Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

deBrush.hpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 /// @file deBrush.hpp
00003 ///
00004 /// @brief Geometry Calculation & storage
00005 ///
00006 /// @author Assassin
00007 ///
00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
00009 /// contents of this file is subject to the Destiny3D Member License which
00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
00011 ///
00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
00014 /// for any particular purpose.
00015 ///
00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
00017 ///
00018 /// <hr>
00019 ///                                 Change History
00020 /// <hr>
00021 ///
00022 /// @date Oct 2001
00023 /// @author Assassin
00024 /// @remarks Creation
00025 ///
00026 /// @date Oct 2002
00027 /// @author Assassin
00028 /// @remarks Major restructuring and interface implementation, deWorld integration
00029 ///
00030 ///////////////////////////////////////////////////////////////////////////////
00031 
00032 #ifndef DEBRUSH_HPP
00033 #define DEBRUSH_HPP
00034 
00035 #include "deGlobalTypes.hpp"
00036 #include "deList.hpp"
00037 #include "deArray.hpp"
00038 //#include "deLine.hpp"
00039 //#include "deDriver.hpp"
00040 #include "deRenderStates.hpp"
00041 #include "deWorld.hpp"
00042 
00043 #if defined(DEBRUSH_DLL_EXPORTS) || defined(DESTINY3D_EXPORT_ALL)
00044 #   define DEBRUSH_API extern "C" DEDLL_EXPORT
00045 #elif defined(DESTINY3D_STATIC_LINK)
00046 #   define DEBRUSH_API extern "C"
00047 #else
00048 #   define DEBRUSH_API extern "C" DEDLL_IMPORT
00049 #endif
00050 
00051 #ifdef USING_DESTINY3D
00052 #ifdef _DEBUG
00053 #   ifdef DESTINY3D_STATIC_LINK
00054 #       pragma comment(lib, "deBrush_sd")
00055 #   else
00056 #       pragma comment(lib, "deBrushd")
00057 #   endif //DESTINY3D_STATIC_LINK
00058 #else
00059 #   ifdef DESTINY3D_STATIC_LINK
00060 #       pragma comment(lib, "deBrush_s")
00061 #   else
00062 #       pragma comment(lib, "deBrush")
00063 #   endif //DESTINY3D_STATIC_LINK
00064 #endif //_DEBUG
00065 #endif //USING_DESTINY3D
00066 
00067 
00068 class IdeBrush;
00069 class IdeGroupBrush;
00070 class IdeBlockBrush;
00071 class IdeCylinderBrush;
00072 class IdeLathedBrush;
00073 class IdeExtrudedBrush;
00074 class IdeStaticBrush;
00075 class IdeLineBrush;
00076 class IdePrismBrush;
00077 class IdeBezierBrush;
00078 
00079 class IdeLine;
00080 class IdeVertexBuffer;
00081 class IdePlaneFrustum;
00082 class IdeSceneNode;
00083 class IdeSolidBrush;
00084 struct deTransformInfo;
00085 
00086 // factory functions down below
00087 
00088 struct BIndexList
00089 {
00090     deVertex *positions;
00091     deVertex *normals;
00092     deTexCoord *uvcoords;
00093     unsigned long numpoints;
00094     unsigned long numtexstages;
00095 
00096     unsigned short *indices;
00097     unsigned long numindices;
00098 };
00099 
00100 struct deBrushVertexData
00101 {
00102     deVertex *positions;
00103     deVertex *normals;
00104     deTexCoord *uvcoords;
00105     deARGB *colors;
00106     unsigned long numpoints;
00107     unsigned long numtexstages;
00108 };
00109 struct deBrushIndexData
00110 {
00111     // set only one of these to a valid pointer, and the other to NULL
00112     unsigned short*indices16;
00113     unsigned long *indices32;
00114     unsigned long numindices;
00115 };
00116 
00117 
00118 /// This is the basic geometry building block of the engine.
00119 /// It can generate its own geometry from inputs or use geometry supplied by the user.
00120 //class IdeBrush : virtual public IdeWorldObject
00121 DE3D_INTERFACE(IdeBrush, IdeWorldObject)
00122 {
00123 protected:
00124     virtual ~IdeBrush() {}
00125 public:
00126     enum deBrushType
00127     {
00128         Brush_Group,
00129         Brush_Block,
00130         Brush_Cylinder,
00131         Brush_Lathed,
00132         Brush_Extruded,
00133         Brush_Static,
00134         Brush_Line,
00135         Brush_Prism,
00136         Brush_Bezier,
00137         Brush_LargeStatic,
00138     };
00139 
00140     virtual void* GetBrushInterface(deBrushType Type) const = 0;
00141     
00142     virtual void GetWorldTransform(deTransformInfo & Matrix) const = 0;
00143 //  virtual void SetWorldTransform(deTransformInfo & Matrix) = 0;
00144     virtual void Rotate(deVec3d &Center, deVec3d &Axis, deDouble Degrees) = 0;
00145     virtual void Rotate(deVec3d &Center, deTransformInfo &M) = 0;
00146     virtual void Translate(deVec3d &Delta) = 0;
00147     virtual void Scale(deVec3d &Center, deDouble scale) = 0;
00148 
00149     virtual deBoolean Update() = 0;
00150     virtual long GetLOD() const = 0;
00151     virtual long GetLOD2() const = 0;
00152     virtual void SetLOD(long LOD) = 0;
00153     virtual void SetLOD2(long LOD2) = 0;
00154 
00155     virtual long GetTexFacesNum() = 0;
00156     virtual long GetTexCoordsNum(long faceindex) = 0;
00157     virtual deTexCoord GetTexCoord(long faceindex, long index) = 0;
00158     virtual void SetTexCoord(long faceindex, long index, deTexCoord &coord) = 0;
00159     virtual void SetTexCoord(long faceindex, long index, deFloat u, deFloat v) = 0;
00160     virtual void SetTexture(long faceindex, IdeRenderTexture * tex) = 0;
00161     virtual IdeRenderTexture* GetTexture(long faceindex) = 0;
00162     virtual void SetSmooth(deBoolean SmoothNotSharp) = 0;
00163     virtual deBoolean GetSmooth() = 0;
00164     
00165     virtual long GetNumCVs() = 0;
00166     virtual void GetCVList(deVec3d buffer[]) = 0;
00167     virtual deVec3d GetCV(long num) = 0;
00168     virtual deBoolean SetCV(long num, deVec3d & CV) = 0;
00169     virtual deBoolean SetCVList(long num, deVec3d CVList[]) = 0;
00170     virtual deBoolean AddCV(deVec3d & point) = 0;
00171 
00172     virtual IdeBrush * Copy() = 0;
00173 
00174     virtual void GetAABB(deVec3d &Mins, deVec3d &Maxs) = 0;
00175 //  deTList <deBPoly> & GetPolyList();
00176 //  void GetPolyList(deTList <deBPoly*> & list);
00177     virtual long GetNumVBs() = 0;
00178     virtual IdeVertexBuffer * GetVertexBuffer(long index) = 0;
00179     virtual void SetDiffuseColor(deARGB color) = 0;
00180     virtual deARGB GetDiffuseColor() = 0;
00181 
00182     virtual void Subtract(IdeBrush * cutter) = 0;
00183 };
00184 
00185 /// Can store other brushes inside this one, and treat them as one.
00186 //class IdeGroupBrush : virtual public IdeBrush
00187 DE3D_INTERFACE(IdeGroupBrush, IdeBrush)
00188 {
00189 protected:
00190     virtual ~IdeGroupBrush() {}
00191 public:
00192 
00193     virtual bool AddBrush(IdeBrush* brush) = 0;
00194     virtual bool RemoveBrush(IdeBrush* brush) = 0;
00195 
00196 //  virtual void GetBrushList(deTList <IdeBrush*> &list) = 0;
00197 };
00198 
00199 /// just contains lines, defined by the CV's.
00200 //class IdeLineBrush : virtual public IdeBrush
00201 DE3D_INTERFACE(IdeLineBrush, IdeBrush)
00202 {
00203 protected:
00204     virtual ~IdeLineBrush() {}
00205 public:
00206 };
00207 
00208 /// A convex hull brush - generates a convex hull that encloses the set of CV's.
00209 //class IdeBlockBrush : virtual public IdeBrush
00210 DE3D_INTERFACE(IdeBlockBrush, IdeBrush)
00211 {
00212     // control vertices are the corner points
00213     // solid is the convex hull from the control vertices
00214 protected:
00215     virtual ~IdeBlockBrush() {}
00216 public:
00217     virtual deBoolean GetProjectedEdgePlanes(const deVec3d & Position, const deTransformInfo & transform, IdePlaneFrustum* pFrustum) = 0;
00218 };
00219 
00220 /// Makes cylinders of any shape and size.
00221 //class IdeCylinderBrush : virtual public IdeBrush
00222 DE3D_INTERFACE(IdeCylinderBrush, IdeBrush)
00223 {
00224     /*
00225     Control Verts:  All used    0,1,2       0,1,2,3
00226       ___              __          __       
00227      / ._\ <-- 0      /  \        /  \      
00228      \_| |. <-- 2    4    \      /    \     
00229     .|   | <-- 4    |   0--2    |  01  2    0---2
00230      | . | <-- 3     \  |1       \    /     |1 /
00231      | ._| <-- 1      \_3         \__/      3_/
00232      \_|
00233      0 & 1 are endpoints of line segment defining the center and length of the cylinder
00234      2 is a point not on segment (0,1) that defines the circumference of the cylinder
00235      3 is an optional point, and will cause the cylinder to be an arc wedge rotating from 2 to 3
00236      4 is an optional point, and will cause the rotation from 2 to 3 to also go through 4
00237     */
00238 protected:
00239     virtual ~IdeCylinderBrush() {}
00240 public:
00241 };
00242 
00243 /// Makes a surface by revolving a line around an axis.
00244 //class IdeLathedBrush : virtual public IdeBrush
00245 DE3D_INTERFACE(IdeLathedBrush, IdeBrush)
00246 {
00247 protected:
00248     virtual ~IdeLathedBrush() {}
00249 public:
00250     enum LatheStyle
00251     {
00252         LatheCap = 0,   // puts caps on the ends of the lathe
00253         LatheCylinder,  // embeds the lathe in the smallest cylinder possible
00254         LatheSurface,   // no solid styling, just lathes the line into a surface
00255         Lathe_32bit = 0x7fffffff,
00256     };
00257 
00258     virtual void SetLine(IdeLine * line) = 0;
00259     virtual IdeLine * GetLine() = 0;
00260 
00261     virtual LatheStyle GetStyle() = 0;
00262     virtual deDouble GetDegree() = 0;
00263     virtual void SetStyle(LatheStyle style) = 0;
00264     virtual void SetDegree(deDouble RotDegree) = 0;
00265 };
00266 
00267 /// makes a surface by extruding a line along another line.
00268 //class IdeExtrudedBrush : virtual public IdeBrush
00269 DE3D_INTERFACE(IdeExtrudedBrush, IdeBrush)
00270 {
00271 protected:
00272     virtual ~IdeExtrudedBrush() {}
00273 public:
00274     virtual void SetSourceLine(IdeLine * source) = 0;
00275     virtual void SetExtrudeLine(IdeLine * extrude) = 0;
00276     virtual void MakeSolid(deBoolean IsSolid) = 0;
00277 };
00278 
00279 // obfuscated, no longer documented
00280 //class IdeStaticBrush : virtual public IdeBrush
00281 DE3D_INTERFACE(IdeStaticBrush, IdeBrush)
00282 {
00283 protected:
00284     virtual ~IdeStaticBrush() {}
00285 public:
00286     virtual void SetTextureState(IdeRenderTexture* texture) = 0;
00287 //  virtual void AddPoly(deBPoly & poly);
00288     virtual void AddIndexedBuffer(BIndexList indexbuffer) = 0;
00289     virtual void BuildIndexedBuffers() = 0;
00290 
00291     virtual deBoolean AddVertices(const deBrushVertexData & vertexdata, long & indexoffset) = 0;
00292     virtual deBoolean AddIndices(const deBrushIndexData & vertexdata, long indexoffset) = 0;
00293 };
00294 
00295 /// A convex hull brush - creates a convex hull defined by the input planes (stored in CV's).
00296 //class IdePrismBrush : virtual public IdeBrush
00297 DE3D_INTERFACE(IdePrismBrush, IdeBrush)
00298 {
00299     /*
00300     p0 = normal, p1 = sample on plane
00301     p2 = normal, p3 = sample on plane
00302     p4 = normal, p5 = sample on plane
00303     p6 = normal, p7 = sample on plane
00304     ...
00305     */
00306 protected:
00307     virtual ~IdePrismBrush() {}
00308 public:
00309 };
00310 
00311 /// Holds a bezier surface, defined by the input CV's.
00312 //class IdeBezierBrush : virtual public IdeBrush
00313 DE3D_INTERFACE(IdeBezierBrush, IdeBrush)
00314 {
00315 protected:
00316     virtual ~IdeBezierBrush() {}
00317 public:
00318 };
00319 
00320 // A variant on the StaticBrush, exposes things more directly
00321 // obfuscated, no longer documented
00322 //class IdeLargeStaticBrush : virtual public IdeBrush
00323 DE3D_INTERFACE(IdeLargeStaticBrush, IdeBrush)
00324 {
00325 protected:
00326     virtual ~IdeLargeStaticBrush() {}
00327 public:
00328     virtual deBoolean SetNumTextures(long NumTextures) = 0;
00329     virtual void SetWorldTransform(deTransformInfo & Matrix) = 0;
00330     virtual deBoolean SetVertexBuffer(long TextureNum, IdeVertexBuffer* VBuffer) = 0;
00331 };
00332 
00333 
00334 // factory functions
00335     DEBRUSH_API deBoolean       IdeBrush_Initialize();
00336     DEBRUSH_API long            IdeBrush_GetWOInterfaceID();
00337     DEBRUSH_API IdeBrush*       IdeBrush_CreateBrush(IdeBrush::deBrushType Type);
00338     DEBRUSH_API deBoolean       IdeBrush_LoadFromXFile(const char * filename, deTList<IdeStaticBrush*> & brushplist);
00339     DEBRUSH_API deBoolean       IdeBrush_LoadLargeStaticeFromXFile(const char * filename, IdeLargeStaticBrush* pBrush, const deTransformInfo * Transform = NULL);
00340     /// ONLY FOR TESTING PURPOSES!
00341     /// DO NOT use Quake 3 maps created in whole or in part with tools that restrict usage of the content.
00342     /// Q3Radiant may not be used to create content for Destiny3D without a full license to the Quake 3 engine.
00343     DEBRUSH_API deBoolean       IdeBrush_LoadFromQ3BSP(const char * filename, IdeLargeStaticBrush* pBrush, deDouble Scale = 1.0);
00344 
00345 #endif
00346 

Generated on Mon Sep 12 19:58:23 2005 for Destiny3D by doxygen1.3-rc3